Audience: Intermediate ECE UNIX system users Summary: Tells how to send binary (and other non-ASCII) files through electronic mail. From: ECE system administration office


E-MAILING A BINARY FILE

Contents

I. Overview

II. General Procedure

III. Example

IV. For More Information

I. Overview

The ECE electronic mail system expects your mail messages to consist entirely of ASCII characters. But what if you want to include a binary (or other non-ASCII) file in an e- mail message? This document describes one way to do this.

You use a standard UNIX utility called "uuencode" to create a special all-ASCII representation of your binary file. The resulting text file can then be sent through e-mail just like any text file.

The recipient of the encoded file then uses another UNIX utility called "uudecode" to put the file back into its original binary form.

II. General Procedure

The SENDER of the binary file should...

  1. Encode the file:

uuencode <binfile> <binfile> > <txtfile> <RET>

2. E-mail the encoded file:

Include <txtfile> in e-mail message as an ordinary text file.

The RECIPIENT of the e-mail message should...

  1. Save the e-mail message to a file.
  2. Decode the file:

uudecode <encodedfile> <RET>

III. Example

Let's say you have a binary file called "a.out" that you want send to your friend Liza.

  1. You encode the file:
You enter the following command to create an all-ASCII representation of the file "a.out" called "a.txt".

uuencode a.out a.out > a.txt <RET>

(Note that you need to specify the filename "a.out" twice.)

2. You add a personal note:

You open up the file "a.txt" in your usual text editor, and add a note to Liza at the top.

Your completed message looks like this --

Dear Liza,

Here's my program "a.out". Decode it with "uudecode". Let me know what you think!

--Gern

                    begin 755 a.out
                    M*B "E *@!)0"0 H7   0U"+A8 ,   C" &'H@)   0*   0!
                    M  !   @, 0   $   (N<(Z @0  ("P$   !   @, 0   )WC
                    M"!$   B0$B'L0   2Y(0( "L$  (D@.@7$   $N4$" @@*(@
                    ...
                    M  "6$N 2F!  %D   "N:$  4+P  "*X5XE01   (D!(A^T
                    M",(#H&B D  ! H  "R   BN%>(HD 3 $I(0 !&4$" '%R
                    end

3. You mail the message:

Now you mail the file "a.txt" to Liza, whose e-mail address you know to be "[email protected]".

(If you use the mail program Elm, you can type "elm [email protected] < a.txt <RET>" at the UNIX prompt.)

The next time Liza reads her mail, she sees your message. In order to restore the encoded file you sent her to its original format, she does the following two things:

  1. Liza saves your message to a file:

From within her mail program, Liza saves your message in her current directory under the name "gern". (Different mail programs have different ways for doing this. From the main screen of Elm, for example, she would select your message and type "s gern <RET>".)

2. Liza decodes the file:

She quits her mail program, and types the following command at the UNIX prompt:

uudecode gern <RET>

And that's it! Liza now has an exact copy of your ori- ginal binary file "a.out" in her current directory!

IV. For More Information


[email protected].
Last Updated: $Date: 2000/02/22 15:47:08 $